#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define R register
#define L long
#define LL long long
#define I inline
#define U unsigned

I LL read()
{
	R LL x;R char f;R char c;
	for (f=0; (c=getchar())<'0'||c>'9'; f=c=='-');
	for (x=c-'0'; (c=getchar())>='0'&&c<='9'; x=(x<<3)+(x<<1)+c-'0');
	return f?-x:x;
}



int a[1000];
int b[1000];
int p[1000];
int main()
{
    int n=read();for(int i=0;i<n;a[i]=read(),++i);
    int m=read();for(int i=0;i<m;b[i]=read(),++i);
    int l=0;
    for(int i=0;i<n;++i)
    {
        for(int j=0;j<m;++j)
            if(a[i]==b[j])
                goto ok1;
        for(int k=0;k<l;++k)
            if(a[i]==p[k])
                goto ok1;
        p[l]=a[i];
        ++l;
ok1:;
    }
    for(int i=0;i<m;++i)
    {
        for(int j=0;j<n;++j)
            if(b[i]==a[j])
                goto ok2;
        for(int k=0;k<l;++k)
            if(b[i]==p[k])
                goto ok2;
        p[l]=b[i];
        ++l;
ok2:;
    }
    for(int i=0;i<l;printf("%s%d",i?" ":"",p[i]),++i);
 	return 0;
}
